home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00043_Script_TrekNave < prev    next >
Text File  |  1999-03-19  |  2KB  |  61 lines

  1. property spr
  2. property tempoSem, tempoViagem
  3. property estado 
  4. property crono,inicio
  5.  
  6. property x_ini, y_ini, dx, dy
  7.  
  8. on beginSprite me
  9.   set spr = the spriteNum of me
  10.   set tempoSem = 180
  11.   set tempoViagem = 120
  12.   
  13.   set estado = 0
  14.   set crono = the timer + tempoSem / 2 + random(tempoSem)
  15. end
  16.  
  17. on cleanSprite me
  18.   puppetSprite spr, false
  19.   set the visibility of sprite spr to true
  20. end
  21.  
  22. on idleSprite me
  23.   global gMustUpdate
  24.   
  25.   if estado = 0 then
  26.     if crono > the timer then return
  27.     set estado = 1
  28.     set crono = tempoViagem / 2 + random(tempoViagem)
  29.     set inicio = the timer
  30.     
  31.     set x_ini = -100
  32.     set dx = 840
  33.     
  34.     set y_ini = random(580) - 50
  35.     set dy = (random(580) - 50) - y_ini
  36.     
  37.     set tmp = random(3) - 1
  38.     if tmp = 2 then 
  39.       set x_ini = x_ini + dx
  40.       set dx = - dx
  41.     end if
  42.     puppetSprite spr,true
  43.     set the member of sprite spr to member ¼
  44.            (the number of member "TrekNaves" + tmp)
  45.     set the loc of sprite spr to point(x_ini,y_ini)
  46.     set the visibility of sprite spr to true
  47.     
  48.   else
  49.     if (the timer - inicio) > crono then
  50.       set estado = 0
  51.       set the visibility of sprite spr to false
  52.       set crono = the timer + tempoSem / 2 + random(tempoSem)
  53.       
  54.     else
  55.       set x = x_ini + dx * (the timer - inicio) / crono
  56.       set y = y_ini + dy * (the timer - inicio) / crono
  57.       set the loc of sprite spr to point(x,y)
  58.       set gMustUpdate = true
  59.     end if
  60.   end if
  61. end